package com.nineclock.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.system.pojo.SysCompanyUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author 黑马程序员
 * @Company http://www.ithiema.com
 * @Version 1.0
 */
@Mapper
public interface SysCompanyUserMapper extends BaseMapper<SysCompanyUser> {
	@Select("SELECT su.* FROM sys_company_user su\n" +
			"         LEFT  JOIN sys_company_user_role scr on scr.company_user_id = su.id\n" +
			"          LEFT JOIN sys_role sr on sr.id = scr.role_id  AND scr.company_id = su.company_id\n" +
			"           WHERE  scr.company_id =#{companyId}  AND sr.role_name='ROLE_ADMIN_SYS'")
	SysCompanyUser findCurrentAdmin(@Param("companyId") Long companyId);
}
